Release 10.1A: OpenEdge Development:
Programming Interfaces
FIND repositioning
After executing
Note: Repositioning does not occur for a subsequentFOREACHstatements orFINDstatements, Progress might reposition subsequentFINDstatements to the last record fetched (except forFINDstatements occurring inPRESELECTblocks). For repositioning to occur, the same record buffer must be used. Also, repositioning afterFOREACHstatements can differ between Progress Version 8.0B and Versions 8.0A and earlier, depending on the options you use.FINDif theFINDspecifies a unique key (that is, theFINDdoes not use theNEXTorPREVoptions).Repositioning after FIND fetches
Progress uses index cursors to keep track of what record you last fetched. This is important if you use the
FINDstatement to fetch a record. For example, depending on what was the last record fetched, the following statement returns a different record:
If you had last fetched the first customer record, this statement would fetch the second customer record. If you had just fetched the fourth customer record, this statement would fetch the fifth customer record.
A table can have multiple indexes, and the cursor position in each index dictates what the next record is in that index. For example, the following code fragment fetches customers 1 and 21:
In the country–post index, the next record after customer 1 is customer 21. Progress uses the index cursor to establish the correct context.
Sometimes cursor repositioning is tricky. For example, the following code fragment returns customer 6 and customer 7 (you might expect customer 6 and customer 2):
The first
FINDstatement causes Progress to reposition the cust–num index cursor to point to customer 6. The secondFINDstatement begins the search from that location, not from the beginning of the cust–num index.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |